<template>
	<view>
		<view  v-show="types=='普通编译'" class="qqqqqq">
		<RichTextEditor
			v-model="WatchValue"
			api-key="95vwhkmmpunt999v8czietowhhziur0qc12omy8m3z0qgw23"
			:init="init"
		/>
			
		</view>
		<view v-show="types=='markdown' || types==''" class="wwwwww">
		<RichTextEditor 
			v-model="WatchValue"
			api-key="95vwhkmmpunt999v8czietowhhziur0qc12omy8m3z0qgw23"
			:init="inits"
		/>
		</view>
	</view>
</template>

<script>
	import Editor from '../tinymce/tinymce-vue'
	export default {
		props:{
			value:String,
			types:{
				type:String,
				default:'普通编译',
			}
		},
		components: {
		    'RichTextEditor': Editor
		},
		data() {
			return {
				WatchValue:this.value,
				init:{
				    min_height: 800,
					fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
					font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;', 
					plugins: [
						'advlist autolink lists link image charmap print preview anchor',
						'searchreplace visualblocks code fullscreen',
						'insertdatetime media table paste code wordcount',
						'autosave  codesample directionality emoticons fullpage hr nonbreaking pagebreak save tabfocus template toc visualchars',
					], // bbcode则个去掉就能正常显示 ，需要md格式的则将他加进去
					toolbar:
						[`
							undo redo | bold italic underline strikethrough | fontsizeselect formatselect | forecolor backcolor  hr| 
							alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent  | 
							 link unlink lists image media | table tabledelete  |
							   codesample |emoticons  insertdatetime | searchreplace | toc| code fullscreen removeformat
						`],
						// ['undo redo | formatselect | bold italic underline forecolor backcolor hr | \
						// 	alignleft aligncenter alignright alignjustify | \
						// 	bullist numlist outdent indent | lists image media | removeformat fullscreen',
						// 	'restoredraft charmap codesample | ltr rtl | emoticons fullpage insertdatetime |\
						// 	link nonbreaking pagebreak paste | preview print | save searchreplace template | toc visualblocks visualchars | wordcount',
						// 	'table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol',
						// ],
					formats:{
						// bold: { inline: 'b', classes: '' },
						// italic: { inline: 'i', classes: '' },
						// underline: { inline: 'u', classes: '' },
						// bold: { inline: 'b', classes: '' },
						// bold: { inline: 'b', classes: '' },
					},
					language: 'zh_CN',
					images_upload_url: '/demo/upimg.php',
					file_picker_callback: function(callback, value, meta) {},
					branding: false,
					draggable_modal: true
				},
				inits:{
				    min_height: 500,
					height: 600,
					fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
					font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;', 
					plugins: [
						'advlist autolink lists link image charmap print preview anchor',
						'searchreplace visualblocks code fullscreen',
						'insertdatetime media table paste code wordcount',
						'autosave  codesample directionality emoticons fullpage hr nonbreaking pagebreak save tabfocus template toc visualchars',
						'bbcode'
					], // bbcode则个去掉就能正常显示 ，需要md格式的则将他加进去
					toolbar:
						[`
							undo redo | bold italic underline strikethrough | fontsizeselect formatselect | forecolor backcolor  hr| 
							alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent  | 
							 link unlink lists image media | table tabledelete  |
							   codesample |emoticons  insertdatetime | searchreplace | toc| code fullscreen removeformat
						`],
						// ['undo redo | formatselect | bold italic underline forecolor backcolor hr | \
						// 	alignleft aligncenter alignright alignjustify | \
						// 	bullist numlist outdent indent | lists image media | removeformat fullscreen',
						// 	'restoredraft charmap codesample | ltr rtl | emoticons fullpage insertdatetime |\
						// 	link nonbreaking pagebreak paste | preview print | save searchreplace template | toc visualblocks visualchars | wordcount',
						// 	'table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol',
						// ],
					formats:{
						// bold: { inline: 'b', classes: '' },
						// italic: { inline: 'i', classes: '' },
						// underline: { inline: 'u', classes: '' },
						// bold: { inline: 'b', classes: '' },
						// bold: { inline: 'b', classes: '' },
					},
					language: 'zh_CN',
					images_upload_url: '/demo/upimg.php',
					file_picker_callback: function(callback, value, meta) {},
					branding: false,
					draggable_modal: true
				}
			};
		},
		watch:{
			WatchValue(value){
				value = value.replace(/<!DOCTYPE html>\n<html>\n<head>\n<\/head>\n<body>\n\n<\/body>\n<\/html>]/ig,'')
				this.$emit('change',value)
			}
		}
	}
</script>

<style>

</style>
